﻿using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;

/// <summary>
/// Reply
/// </summary>
public class Reply
{
    DBControl dbcontrol = new DBControl();

    #region 根据TopicID获取回复信息
    /// <summary>
    /// 根据TopicID获取回复信息
    /// </summary>
    /// <param name="iTopicID"></param>
    /// <returns>ds</returns>
    public DataSet GetReplyByTopicID(int iTopicID)
    {
        string strCMD = "SELECT * FROM tb_ReplyInfo WHERE TopicID='"+iTopicID+"'";
        DataSet ds = dbcontrol.GetDataSet(strCMD,"ReplyInfo");
        return ds;
    }
    #endregion

    #region 回复主题
    /// <summary>
    /// 回复主题
    /// </summary>
    /// <param name="iTopicID"></param>
    /// <param name="strUserName"></param>
    /// <param name="strReplyTitle"></param>
    /// <param name="strReplyContent"></param>
    /// <param name="dtReplyDate"></param>
    /// <param name="strUserIP"></param>
    /// <returns></returns>
    public int ReplyTopic(int iTopicID, string strUserName,
        string strReplyTitle, string strReplyContent,
        DateTime dtReplyDate, string strUserIP)
    {
        string strCMD = "INSERT INTO tb_ReplyInfo(TopicID,UserName,ReplyTitle,ReplyContent,ReplyDate,UserIP)"
            +" VALUES('"+iTopicID+"','"+strUserName
            +"','"+strReplyTitle+"','"+strReplyContent
            + "','" + dbcontrol.DateTimeToString(dtReplyDate) + "','" + strUserIP + "')";
        int iResult=dbcontrol.SqlExecuteNonQuery(strCMD);
        return iResult;
    }
    #endregion
}
